<template>
  <div class="container">

    <data-view
      propViewKey="finance_bill_account_check"
      ref="dataviewChild"
      :propAutoFetchData="false"
      :propCustomCols="myPropCustomCols"
      :propShowToolBar="true"
      class="data-view-child"
    >
      <template #accountCheckStatus="{field,value,row}" >
        <el-tag v-if="value == 'end'" type="success" effect="dark">已扎账</el-tag>
        <el-tag v-else type="warning" effect="dark">未扎帐</el-tag>
      </template>
    </data-view>
  </div>
</template>

<script>
/*eslint-disable*/
export default {
  data() {
    return {
      txtScan: ''
    }
  },
  methods: {
    //扫码单号
    doScan() {
      if(!this.txtScan){
        this.$refs.txtScan.focus()
        this.utilMessage.warning(" 请输入单号进行查询")
        return
      }
      this.utilVue.loadShow(true)
      this.$ajax.get(`wm/stock/getStockByUCOnly?uc=${this.txtScan}` ).then((response) => {
        if(response.code == 0 ){
          this.utilMessage.success(response.msg)
          this.txtScan = '';
          if(response.data ){
            this.form = response.data
            if(this.form.rfid && this.form.rfid.length >4) this.btnUnbindDisabled = false
            this.btnPrintDisabled = false
          }else{
            this.btnUnbindDisabled = true
            this.$refs.txtScan.focus()
          }
        }
        this.utilVue.loadHide()
      })
    }
  },
  created() {
  },
  props: {
    propParent: Object,
    propInitData: Object,
    propPrimaryKey: String,
    propDictionaries: Object,
    propCurrentRow: Object,
    propViewFormData: Object,
    propReadonly: Boolean,
    propStatus: String,
    propRules: Object
  },
  components: {
  },
  computed: {
    //自定义列
    myPropCustomCols(){
      return [
        {
          name: 'accountCheckStatus',
          cmode: 'edit'
        }
      ]
    }
  },
  mounted() {
    let wrapper = this.$newWrapper().eq('accountCheckId', this.propCurrentRow.id)
    this.$refs.dataviewChild.setQueryWrapper(wrapper)
  }
}
</script>

<style lang="scss" scoped>
  .container {
    width: 100%;
    height: 100%;
    .data-view-child{
      padding-top: 0px;
      /deep/ .vxe-grid{
        .vxe-toolbar{
          height: auto;
        }
       .vxe-tools--operate{
          margin-top: 0px;
        }
      }
    }
  }
</style>
